package com.shuoyue.ycgk.ui.mine.mok;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseViewHolder;
import com.shuoyue.ycgk.R;
import com.shuoyue.ycgk.base.baseadapter.AppBaseQuickAdapter;
import com.shuoyue.ycgk.entity.Mok;

import java.util.List;

public class MyMokAdapter extends AppBaseQuickAdapter<Mok> {

    public MyMokAdapter(@Nullable List<Mok> data) {
        super(R.layout.item_main_mok_mine, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Mok item) {
        helper.addOnClickListener(R.id.report);
        helper.addOnClickListener(R.id.lay_course);

        helper.setText(R.id.title, item.getTitle());
//        helper.setText(R.id.statue, item.getStatusInt() + "");
        helper.setText(R.id.time, item.getStartTime()+"  "+item.getMockStatus());
        helper.setText(R.id.info, "共" + (item.getTotalQuestion()) + "题   " + item.getTotalMinute() + "分钟");
        helper.setText(R.id.report, item.getMemberStatus());
        helper.setGone(R.id.lay_course, item.getRecommendProduct() != null);
        if (item.getMockStatusInt() == 0) {
            helper.setBackgroundRes(R.id.time, R.drawable.my_mok_orange);

        } else if (item.getMockStatusInt() == 1) {
            helper.setBackgroundRes(R.id.time, R.drawable.my_mok_blue);
        } else {
            helper.setBackgroundRes(R.id.time, R.drawable.my_mok_gray);
        }
        //      模考状态：0未开始1已开始2已结束
        //用户报名状态：0未报名1已报名
    }
}
